from jwt import decode


def result_success(data) -> dict:
    return {'status': '200', 'message': '请求成功', 'data': data}


def result_error(status: str, message: str) -> dict:
    return {'status': status, 'message': message, 'data': None}


def get_source_from_data(data: dict) -> str:
    token = data['Authorization']
    payload = decode(token, verify=False)
    return payload['aud']
